---
layout: default
title: Using Shuffle with Requirejs
description: A simple example of how you can use Shuffle with an AMD loader like RequireJS.
image: /demos/requirejs.jpg
extraJS: []
requirejs: true
---

<div class="container">
  <div class="row">
    <div class="col-12@sm">
      <h2>RequireJS!</h2>
      <p>
        Shuffle uses a UMD wrapper, so it is compatible with AMD loaders like <a href="https://requirejs.org">RequireJS</a>. The UMD wrapper also allows Shuffle to work with CommonJS modules. You can take a peek at the <a href="{{ site.baseurl }}/js/require-main.js">config file</a> used on this page.
      </p>
    </div>
  </div>
</div>


<style>
  .shuffle-wrap {
    position: relative;
  }

  #grid .img-item {
    margin-top: 16px;
    margin-left: 0;
  }

  #grid .img-item img {
    width: 100%;
  }
</style>

<div class="container shuffle-wrap">
  <div id="grid" class="my-shuffle-container row">
    {% for item in site.data.items %}
    <figure class="js-item img-item col-3@sm col-3@xs">
      <div class="aspect aspect--16x9">
        <div class="aspect__inner">
          <img src="{{ item.images.small }}" srcset="{{ item.images.small }} 1x, {{ item.images.small-2x }} 2x" alt="{{ item.description }}" />
        </div>
      </div>
      <figcaption>{{ item.title }}</figcaption>
    </figure>
    {% endfor %}
    <div class="col-3@sm col-3@xs" id="js-sizer"></div>
  </div>
</div>


<section class="container">
  <div class="row">
    <div class="col-12@sm">
      <h2>Shuffle.js</h2>
      <p>{{ site.longDescription }}</p>
    </div>
  </div>
</section>
